package cn.itcast.controller;


import cn.itcast.service.WeatherService;
import org.checkerframework.checker.units.qual.A;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @program: xiaohua-service
 * @ClassName TestController
 * @author: WXK
 * @create: 2023-10-28 10:07
 **/
@RestController
@RequestMapping("/xiaohua")
@RefreshScope
public class TestController {
    @Autowired
    private  WeatherService weatherService;

//    @Value("${pattern.name}")
//    private String name ;


    @GetMapping("/test/{cityName}") //浏览器测试正常 http://localhost:8001/xiaohua/test/%E8%A5%BF%E5%AE%89
    public void  saveWeather ( @PathVariable  String cityName ){
        weatherService.saveWeather(cityName);
    }
}
